package com.xb.loan.admin.service.system.impl;

import com.xb.loan.admin.bean.system.OssOperator;
import com.xb.loan.admin.dao.system.OssOperatorDao;
import com.xb.loan.admin.service.system.OperatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


@Service("operatorService")
public class OperatorServiceImpl implements OperatorService {
    @Autowired
    OssOperatorDao ossOperatorDao;


    public OssOperator queryOperatorByLoginName(String loginName) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("loginName", loginName);     
        map.put("partnerId", "0");     
        OssOperator ossOperator = ossOperatorDao.queryOperatorByLoginName(map);
        
        return ossOperator;
    }
    
    public OssOperator selectOperatorByKey(String operatorId){
        OssOperator ossOperator = ossOperatorDao.selectByPrimaryKey(operatorId);
        return ossOperator;
    }


    @Override
    public int updateOperatorPassword(String operatorId, String pwd) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("operatorId", operatorId);     
        map.put("loginPwd", pwd);
        
        return ossOperatorDao.updateOperatorPassword(map);
    }

    
    @Override
    public int updateOperatorInfo(OssOperator ossOperator) {
        return ossOperatorDao.updateByPrimaryKeySelective(ossOperator);
    }

}
